package HomeWork07;

/**
 * @author 李孟琦
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: HomeWork07
 * @ClassName: 007
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/10/9 17:24
 * @Copyright 李孟琦版权所有
 */
public class Voter {
    //7.选民投票Voter，每人只允许投票一次，当票数达到100时停止投票。static静态关键字
    private static int count;  //所有选民

    private static final int MAX_COUNT = 100;

    private String name;

    public Voter() {
    }

    public Voter(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public void voteFor(){
        if (count==MAX_COUNT){
            System.out.println("投票活动已经结束，感谢您的参与!");
            return;
        }else {
            count++;
            System.out.println(this.name+"感谢您的投票!");
        }
    }
}
